﻿<%@ Page Title="ScrumPeak.com" Language="C#" MasterPageFile="~/Views/Shared/Site.Master"
  AutoEventWireup="true" Inherits="System.Web.Mvc.ViewPage<IList<ProjectModel>>" %>
<%@ Import Namespace="Peak.Web.Controllers.HtmlExtentions"%>
<%@ Import Namespace="System.Threading"%>

<%@ Import Namespace="Peak.Web.Controllers" %>
<%@ Import Namespace="Peak.Core" %>
<%@ Import Namespace="Peak.Web.Controllers.Models" %>
<%@ Import Namespace="Peak.Resources" %>
<asp:Content ContentPlaceHolderID="center" runat="server">
  <div class="page-title">
    <%= PageTitles.Projects %></div>
  <div class="page-content">
    <%= Html.PeakButton<ProjectController>(f=>f.New(),Buttons.AddNew) %>
    <table class="table">
      <thead>
        <tr>
          <th style="width:30%">
            <%= Columns.Name %>
          </th>
          <th>
            <%= Columns.Vision %>
          </th>
          <th class="autoWidthColumn">
            Default
          </th>                    
        </tr>
      </thead>
      <tbody>
        <% foreach (ProjectModel project in Model)
           {%>
        <tr>
          <td valign="top">
            <%= Html.ActionLink<ProjectsController>(f => f.SelectProject(project.ProjectId), project.Name)%>
            <div class="action" >
              <img src="<%= ResolveUrl("~/Content/Images/trash.png")%>" onclick="confirmDelete('<%= Messages.ConfirmDelete %>','<%= Html.BuildUrlFromExpression<ProjectsController>(f=>f.Remove(project.ProjectId)) %>')"/>                       
            </div>
            <a class="action" href="<%= Html.BuildUrlFromExpression<ProjectController>(f=>f.Edit(project.ProjectId)) %>">
              <img src="<%= ResolveUrl("~/Content/Images/edit.png")%>" />           
            </a>
          </td>
          <td>
            <%= project.Vision %>
          </td>
          <td align="center">            
            <% if (project.Default)
               {%>
                  <img src="<%= ResolveUrl("~/Content/Images/tick.png")%>" width="20" height="20" />
               <%
               }%>
          </td>          
        </tr>
        <% } %>
        <% if (Model.Count == 0)
           {%>
        <tr>
          <td colspan="20">
             <%= Messages.NoResults %>
          </td>                       
        </tr> 
        <%
           }%>
      </tbody>
    </table>
  </div>
</asp:Content>
